<template>
  <div>
    <!-- table -->
    <!-- 质量报告查询 - 明细 -->
    <BreakSpace label="质量信息" :containerStyle="{ marginBottom: '10px' }"/>
    <FormPanel ref="formPanel1" :list="formList" :cols="3" :formType="'add'" labelWidth="100" :isSubmitBtn="false"
               @formChange="formChangeHandle"/>
    <div style="margin-bottom: 1rem;"></div>
    <BreakSpace label="故障码列表" :containerStyle="{ marginBottom: '10px' }"/>
    <FilterTable
      ref="table"
      :columns="columns"
      :params="fetchParams"
      :dataSource="dataList"
      :datakey="'items'"
      :onColumnsChange="columns => (this.columns = columns)"
      :onRowSelectChange="selectChange"
      selectionType="single"
    ></FilterTable>
    <div style="margin-bottom: 1rem;"></div>
    <BreakSpace label="配件列表" :containerStyle="{ marginBottom: '10px' }"/>
    <FilterTable
      ref="table"
      :columns="columns2"
      :params="fetchParams"
      :dataSource="dataList2"
      :datakey="'items'"
      :onColumnsChange="columns => (this.columns2 = columns2)"
      :onRowSelectChange="selectChange"
      selectionType="single"
    ></FilterTable>
    <div style="margin-bottom: 1rem;"></div>
    <BreakSpace label="历史审核记录" :containerStyle="{ marginBottom: '10px' }"/>
    <FilterTable
      ref="table"
      :columns="columns3"
      :params="fetchParams"
      :dataSource="dataList3"
      :datakey="'items'"
      :onColumnsChange="columns => (this.columns3 = columns3)"
      :onRowSelectChange="selectChange"
      selectionType="single"
    ></FilterTable>
    <div style="margin-bottom: 1rem;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }">
      <multiuse-button type="primary" @click="closeDialog">关 闭</multiuse-button>
    </div>
    <div style="margin-bottom: 4rem;"></div>
  </div>
</template>
<script>

export default {
  // mixins: [dictionary],
  components: {
  },
  data() {
    return {
      dataList: [],
      dataList2: [],
      dataList3: [],
      collapse: false,
      infoId: null,
      columns: this.creatHeader(),
      columns2: this.creatHeader2(),
      columns3: this.creatHeader3(),
      // topFilterInit: this.topFilterInitFun(),
      // fetchApi: getUser,
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中经销商
      formList: this.createFormList(),
      saveData: null
    };
  },
  created() {
  },
  methods: {
    //质量信息
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '质量报告单号',
          fieldName: 'techNo',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '维修工单号',
          fieldName: 'techStatus',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '最新检测时间',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '生产日期',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '销售日期',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '维修开始时间',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '维修结束时间',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '行驶里程',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '车型名称',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '制单人',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '联系方式',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '主损件',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '主损件名称',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '索赔单号',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '故障现象代码',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '故障现象描述',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '系统代码',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '系统名称',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '子系统代码',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '子系统名称',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '现象代码',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'INPUT',
          label: '现象描述',
          fieldName: 'ifFirst',
          readonly: true,// 只读
          disabled: true // 置会
        },
        {
          type: 'TEXT_AREA',
          label: '故障描述',
          fieldName: 'evaluateRemarks',
          readonly: true,// 只读
          disabled: true,// 置会
          selfCols: 3,// 元素占据几行
          rows: 1
        },
        {
          type: 'TEXT_AREA',
          label: '维修经过',
          fieldName: 'evaluateRemarks',
          readonly: true,// 只读
          disabled: true,// 置会
          selfCols: 3,// 元素占据几行
          rows: 1
        },
        {
          type: 'TEXT_AREA',
          label: '维修结果',
          fieldName: 'evaluateRemarks',
          readonly: true,// 只读
          disabled: true,// 置会
          selfCols: 3,// 元素占据几行
          rows: 1
        },
        {
          type: 'TEXT_AREA',
          label: '建议意见',
          fieldName: 'evaluateRemarks',
          readonly: true,// 只读
          disabled: true,// 置会
          selfCols: 3,// 元素占据几行
          rows: 1
        },
        {
          type: 'TEXT_AREA',
          label: '使用环境',
          fieldName: 'evaluateRemarks',
          readonly: true,// 只读
          disabled: true,// 置会
          selfCols: 3,// 元素占据几行
          rows: 1
        },
        {
          type: 'INPUT',
          label: '附件',
          fieldName: 'title',
          placeholder: '请输入附件...',
          selfCols: 3,
          readonly: true, // 只读
          unitRender: props => {
            return (
              <div>
                <multiuse-button type="primary" style="background-color: #1890FF;color: #FFFFFF">下载附件</multiuse-button>
              </div>
            );
          }
        },
        {
          type: 'SELECT',
          label: '质量报告是否合格',
          fieldName: 'cid',
          itemList: [{ text: '热点', value: '1' }, { text: '资讯', value: '2' }],
          rules: [{ required: true, message: '请选择所属分类', trigger: 'change' }],
          readonly: true, // 只读
          disabled: true // 禁用
        }
      ];
    },
    //故障码列表
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {title: '故障码', dataIndex: 'date', sorter: true},
        {title: '故障码描述', dataIndex: 'date', sorter: true},
      ];
    },
    //配件列表
    creatHeader2() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {title: '配件代码', dataIndex: 'date', sorter: true},
        {title: '配件名称', dataIndex: 'date', sorter: true},
        {title: '单位', dataIndex: 'date', sorter: true},
        {title: '数量', dataIndex: 'date', sorter: true},
        {title: '索赔单价', dataIndex: 'date', sorter: true},
        {title: '索赔总价', dataIndex: 'date', sorter: true},
        {title: '返件类型', dataIndex: 'date', sorter: true},
        {title: '旧件合格状态', dataIndex: 'date', sorter: true}
      ];
    },
    //历史审核记录
    creatHeader3() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {title: '操作单位', dataIndex: 'date', sorter: true},
        {title: '操作人', dataIndex: 'date', sorter: true},
        {title: '操作时间', dataIndex: 'date', sorter: true},
        {title: '操作类型', dataIndex: 'date', sorter: true},
        {title: '操作备注', dataIndex: 'date', sorter: true}
      ];
    },

    formChangeHandle(val) {
      console.log(val);
      this.saveData = val;
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //取消操作
    closeDialog() {
      this.$emit('close', {visible: false, data: this.selectedRows, type: 'close'});
    }
  }
};
</script>

<style lang="less" scoped></style>
